import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
const jsonData = require('../project.json')
let project1 = jsonData.project
let crmtitle = jsonData['default/'].crmtitle
if (jsonData[project1] !== undefined) {
  crmtitle = jsonData[project1].crmtitle
}
export default new Vuex.Store({
  state: {
    crmtitle: crmtitle,
    ref_id: '',
    ref_show: '',
    ref_field: '',
    ref_item: {},
    isreload: false,
    logintype: 'wechat',
    ref_arr: [],
    refInsertPointInfo:null
  },
  mutations: {
    listreload (state) {
      state.isreload = true
    },
    clearreload (state) {
      state.isreload = false
    },
    setlogintype (state, logintype) {
      //console.log('index state', state)
      state.logintype = logintype
      //console.log('index state', state)
    },
    refReBack (state, refObj) {
      //console.log('state', state)
      state.ref_id = refObj.ref_id
      state.ref_show = refObj.ref_show
      state.ref_field = refObj.ref_field
      state.ref_item = refObj.ref_item
      state.ref_arr = refObj.ref_arr
      state.ref_map = refObj.ref_map
      state.ref_toobject = refObj.ref_toobject
      
      //console.log('state', state)
    },

    orgRefReBack (state, refObj) {
      //console.log('state', state)
      state.ref_id = refObj.ref_id
      state.ref_show = refObj.ref_show
      state.ref_field = refObj.ref_field
      state.ref_item = refObj.ref_item
      state.ref_arr = refObj.ref_arr
      //console.log('state', state)
    },
    clearRef (state) {
      state.ref_id = ''
      state.ref_show = ''
      state.ref_field = ''
      state.ref_item = {}
      state.ref_arr = []
    },

    setRefInsertPointInfo(state,refInsertPointInfo){
      state.refInsertPointInfo  = refInsertPointInfo
    }



  },
  actions: {
  },
  modules: {
  }
})
